package com.mo.design.pattern.creational.singleton;

public class DoubleCheckSynchronizedSingleton {

    private static DoubleCheckSynchronizedSingleton instance;

    private DoubleCheckSynchronizedSingleton() {};

    public static  DoubleCheckSynchronizedSingleton getInstance() {
        if  (instance == null) {
            synchronized (DoubleCheckSynchronizedSingleton.class) {
                if (instance == null) {
                    instance = new DoubleCheckSynchronizedSingleton();
                }
                return instance;
            }
        }
        return instance;
    }
}
